package com.lagou.service;

import com.lagou.pojo.Article;
import com.lagou.repository.ArticleJpaRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

/**
 * @ClassName ArticleService
 * @Description TODO
 * @Author Administrator
 * Date 2020/3/22 0022 下午 1:47
 * Version 1.0
 */
@Service
public class ArticleService {
    @Autowired
    private ArticleJpaRepository articleJpaRepository;

    public Page<Article> findAllPageable(int page,int size){
        PageRequest pageRequest = PageRequest.of(page, size);
        Page<Article> all = articleJpaRepository.findAll(pageRequest);
        return all;
    }
}
